home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / unicode_start < prev    next >
Encoding:
Text File  |  2007-01-22  |  1.5 KB  |  63 lines

  1. #!/bin/sh
  2. # start unicode mode
  3.  
  4. if [ ! -e /proc/self/fd/0 ] ; then
  5.    echo "Won't set unicode mode: Can't determine console type;" >&2
  6.    echo " Please ensure that /proc is mounted." >&2
  7.    exit 1
  8. fi
  9.  
  10. readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
  11. if [ $? -eq 1 ]; then
  12.     echo  "Won't set unicode mode: not a VT." >&2
  13.     exit 1
  14. fi
  15.  
  16. if [ -n "$previous" ] && [ -n "$runlevel" ] || [ "$runlevel" = "S" ]; then
  17.     RUN_FROM_INIT="yes"
  18. fi
  19.  
  20. if /usr/bin/vt-is-UTF8 --quiet && [ "$RUN_FROM_INIT" != "yes" ]; then
  21.     echo "unicode_start: Already in UTF8 mode" >&2
  22.     exit 0
  23. fi
  24.  
  25. # We want kbd to be in unicode mode before we run loadkeys; 
  26. # otherwise confusion over keysyms reigns.
  27. kbd_mode -u
  28. dumpkeys | loadkeys --unicode > /dev/null
  29.  
  30.  
  31. case $# in
  32.     2)
  33.         consolechars --font=$1 --sfm=$2
  34.     ;;
  35.     1)
  36.         consolechars --font=$1
  37.     ;;
  38.     0)
  39.     ;;
  40.     *)
  41.         echo "usage: unicode_start [font [unicode map]]"
  42.     ;;
  43. esac
  44.  
  45. # set DEVICE_PREFIX depending on devfs/udev
  46. if [ -d /dev/vc ]; then
  47.     DEVICE_PREFIX="/dev/vc/"
  48.     else
  49.      DEVICE_PREFIX="/dev/tty"
  50. fi
  51.  
  52. NUM=`fgconsole --next-available`
  53. NUM=`expr ${NUM} - 1 `
  54. # This needs a better fix, but because unicode_{start,stop} are called
  55. # before getty starts the other consoles, if only one console set, then
  56. # set for the first 6 VTs, since  these are normally started by inittab
  57. [ $NUM -eq 1 ] && NUM=6
  58. for vc in `seq 1 ${NUM}` 
  59. do
  60.   # Since 1.2.1 - for older kernels, use: echo -n -e '\033%8'
  61.   /bin/echo -n -e '\033%G' > ${DEVICE_PREFIX}${vc}
  62. done
  63.